All Questions
34 questions
1vote
3answers
2kviews
Math calculation JavaScript. Am I using Objects correctly? Can I use methods / functions to shorten my code further? Also error logging?
Context- CRM system, front-end form. Requirement- Within a form users have to give a rating to a section based on user inputs, each rating has different weighting. The rating is stored in an option ...
2votes
2answers
319views
Tic-Tac-Toe vanilla JS Pseudo OOP
I'm working on building a simple game in vanilla JS (tic-tac-toe). Some weeks ago I created a functional MVP and asked some questions about it (Vanilla JS Tic-Tac-Toe). The code worked, but it was a ...
8votes
3answers
402views
Stopwatch interface OOP (Vanilla JS)
I'm learning OOP and the first exercise of the course was to made a Stopwatch class. I did it really fast and decided to make an interface for this little app. I created the interface. Basically I ...
0votes
1answer
92views
Best method to further execute the DRY principle and/or raise performance in my script? (client login/signup system)
Just for practice purposes, I written a basic client sided login/signup system that allows you to make an account, and then log into the account from my webpage. What it does is append to an object ...
2votes
1answer
89views
Simple JS OOP - Clicking the box to fetch and display object content
I'm relatively new to OOP with JS and want to find out: If my code can be improved somehow, and key question Identify how and where I can typically use OOP more in my job (as I can usually just use ...
2votes
2answers
2kviews
Create User Class
Create a user class with id, name, age. Write a function to get users older than age 20. Group all users with same age and increment users age by 3 Is there a cleaner way to write this? Any comments ...
2votes
1answer
162views
Temperature and currency converters in OOP JS
I just started learning OOP from Mosh on YouTube and I looked for easiest exercises to practice. Can I get a feedback on my code please? What I did wrong and what I should change? In the code there ...
2votes
2answers
4kviews
Simple calculator in Object-oriented JavaScript
There is a simple form which takes two numbers num1, num2 and an operation op. After ...
5votes
1answer
126views
JS Simple game in canvas
I'm trying to learn javascript (especially the OOP part) and made this simple game. I'm looking for advice and ways to improve my code. Did I handle OOP well enough? What's the best way to create a ...
4votes
3answers
2kviews
Basic orbiting planets in P5.js
I started studying JavaScript about a week ago and I would like some opinions and advice on my code. This program just creates a canvas and instantiates 5 planets that orbit around a sun, giving them ...
3votes
1answer
1kviews
Javascript Snake
I have implemented a little snake game with Javascript and Html. This is my first game with Javascript. I use a Linkedlist to represent the snake. Both code snippets are in snake.js file. It would be ...
2votes
1answer
68views
Appending data to a web page from a form using a JavaScript class
Recently I've been reading about classes in JavaScript and decided to code this simple form to test them out. Even if the code works I am still pretty sure I lack understanding of classes and other ...
3votes
0answers
38views
Loading NRRDs, images and names of parts and segments
I am creating a program to show NRRDs which are a format of medical images. In addition it loads a gallery of thumbnails, where each thumbnail has a link to change the selected NRRD. Plus there is a ...
2votes
0answers
51views
Event handler re-use in Javascript
I've been trying to deal with a lot of duplicate code in the first web pages I've been working on and have been playing around with the prototype model, which I think is the 'right' way to go about it....
8votes
1answer
26kviews
Shopping cart in pure JavaScript
I need help in making this shopping cart adhere to the W3C rules. This is already 100% functioning. I just need help in making this code as clean and as short as possible. I want it in pure ...